﻿using ERP.Inventory.Api.Read.Application.Command.台账;
using ERP.Inventory.Api.Read.Application.Command.库存管理;
using ERP.Inventory.Api.Read.DTO;
using ERP.Inventory.Domain.库存管理;
using ERP.Inventory.Errorcode;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace ERP.Inventory.Api.Read.Controllers
{
    /// <summary>
    /// 工单控制器
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class GetCheckController : ControllerBase
    {
        private readonly IMediator mediator;
        private readonly ILogger<GetCheckController> logger;

        public GetCheckController(IMediator mediator, ILogger<GetCheckController> logger)
        {
            this.mediator = mediator;
            this.logger = logger;
        }
        /// <summary>
        /// 显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiPaging<CheckDTO>> GetCheck([FromQuery]GetCheckCommand request)
        {
            //异常处理
            try
            {
                return mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 绑定仓库
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<StoreModel>>> GetStore([FromQuery] GetStoreCommand request)
        {
            //异常处理
            try
            {
                return mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 详情
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<CheckDTO>> Details([FromQuery]DetailsCommand request)
        {
            //异常处理
            try
            {
                return mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 商品显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiPaging<ShopModel>> GetShop([FromQuery] GetShopCommand request)
        {
            //异常处理
            try
            {
                return mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 中间表的显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public  async Task<ApiResult<ShopandcheckDTO>> GetCheckShop([FromQuery] GetCheckShopCommand request)
        {
            //异常处理
            try
            {
                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 出入库显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiPaging<PutDTO>> GetPut([FromQuery] GetPutCommand request)
        {
            //异常处理
            try
            {
                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 商品仓库显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiPaging<ShopandStoreDTO>> ShopandStore([FromQuery] ShopandStoreCommand request)
        {
            //异常处理
            try
            {
                return mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 显示中间表
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiPaging<cssDTO>> Getcss([FromQuery] GetcssCommand request)
        {
            //异常处理
            try
            {
                return mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
        //[HttpGet]
        //public IActionResult getcheck()
        //{
        //    return Ok("123");
        //}
    }
}
